x = [1 0 1 1 1 1 0 1];
y = [0 1 1 1 1 0 0 1];

dif = abs(x - y);

max(size(find(dif == 0)))